<template>
  <div>
    <el-dialog
      v-model="dialogVisible"
      width="80%"
      align-center
      :show-close="false"
      destroy-on-close
      draggable
    >
      <template #header="{ close }">
        <div class="dialog-header flex justify-between items-center">
          <div>项目审核</div>
          <el-icon class="el-icon--left cursor-pointer" @click="close"
            ><CircleCloseFilled color="#fff"
          /></el-icon>
        </div>
      </template>
      <ProjectInfo />
      <ProjectMember />
      <ProjectBudget />
      <template #footer>
        <div class="dialog-footer">
          <Checkcomponents :procInsId="procInsId" class="mt-[10px]" @success="checkSuccess" />
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import Checkcomponents from "@/views/flowable/processInstance/detail/components.vue";
import ProjectInfo from "./ProjectInfo.vue";
import ProjectMember from "./ProjectMember.vue";
import ProjectBudget from "./ProjectBudget.vue";
import useCommonFetch from "@/hooks/useCommonFetch";
import useDictFetch from "@/hooks/useDictFetch";
/**获取公共下拉数据开始*/
const memberTypeList = useCommonFetch("成员类型");
const unitList = useCommonFetch("成果归属单位");
const allUnitList = useCommonFetch("所有单位");
const projectTypeList = useCommonFetch("项目分类（校级）");
const projectStatusList = useCommonFetch("项目状态");
const tjgsList = useCommonFetch("教育部统计归属");
const jjfwmbList = useCommonFetch("社会经济服务目标");
const hzTypeList = useCommonFetch("合作形式");
const gmjjhyList = useCommonFetch("国民经济行业");
const applierTitleList = useCommonFetch("职称");
const degreeList = useCommonFetch("学位");
const cdTypeList = useCommonFetch("项目-承担角色");
const checkStatusList = useDictFetch("bpm_process_instance_status"); //审核状态
provide("memberTypeList", memberTypeList);
provide("unitList", unitList);
provide("allUnitList", allUnitList);
provide("projectTypeList", projectTypeList);
provide("projectStatusList", projectStatusList);
provide("tjgsList", tjgsList);
provide("jjfwmbList", jjfwmbList);
provide("hzTypeList", hzTypeList);
provide("gmjjhyList", gmjjhyList);
provide("applierTitleList", applierTitleList);
provide("degreeList", degreeList);
provide("cdTypeList", cdTypeList);
provide("checkStatusList", checkStatusList);
/**获取公共下拉数据结束*/
const dialogVisible = ref(false);
const operateId = ref(null);
const procInsId = ref(null); //流程实例id
provide("id", operateId);
const check = (id, processId) => {
  operateId.value = id;
  procInsId.value = processId;
  dialogVisible.value = true;
};
defineExpose({ check });
const emit = defineEmits(["check-success"]);
const checkSuccess = () => {
  dialogVisible.value = false;
  emit("check-success");
};
</script>

<style scoped lang="scss">
@import url("@/views/project/index.scss");
:deep(.el-dialog__body) {
  height: calc(100% - 180px);
}
</style>
